package com.example.teamtribe.main.chat.request;

import android.os.Bundle;
import android.support.annotation.Nullable;

import com.example.teamtribe.common.Back;
import com.example.teamtribe.common.model.RelationModel;
import com.example.teamtribe.utils.Utility;

public class RequestPresenter implements RequestContract.Presenter {

    private RequestContract.View view;

    public RequestPresenter(RequestContract.View view) {
        this.view = view;
    }

    @Override
    public void agree(int id) {
        view.showProgress();
        RelationModel.getInstance().response(Utility.getToken(), id, 1, "", new Back() {
            @Override
            public void success(@Nullable Bundle bundle) {
                view.next();
            }

            @Override
            public void failure(String meg) {
                view.hideProgress();
                view.showToast(meg);
            }
        });
    }
}
